#include "cmsis_os2.h"
#include "usart.h"
#include "ble.h"

USART1_RECEIVETYPE Usart1_Type;
USART1_RECEIVETYPE usart1_rx;
extern osMessageQueueId_t myQueue01Handle;

void USART1_RxIdleCallback(UART_HandleTypeDef *huart)
{
	if ((__HAL_UART_GET_FLAG(huart,UART_FLAG_IDLE) != RESET)) {
		__HAL_UART_CLEAR_IDLEFLAG(huart);
		HAL_UART_DMAStop(huart);
		Usart1_Type.RX_Size = USART1_LEN - huart->hdmarx->Instance->NDTR;
		/************************************************************************************/
		if (Usart1_Type.RX_Size <= USART1_LEN)
			osMessageQueuePut(myQueue01Handle, &Usart1_Type, 0U, 0U);
//		HAL_UART_Transmit(&huart2, &Usart2_Type.RX_pData[0], Usart2_Type.RX_Size, 0xFFFF);
		memset(&Usart1_Type.RX_pData, 0x00, Usart1_Type.RX_Size);
		/************************************************************************************/
		__HAL_UART_CLEAR_OREFLAG(huart);
		HAL_UART_Receive_DMA(huart, &Usart1_Type.RX_pData[0], USART1_LEN);
	}
}
void usart1_rx_deal(USART1_RECEIVETYPE *usart1_rx)
{

}
